package flyweight.source;

/**
 * @author cheng:
 * @date 2019/4/25 10:45
 */
public class Test {
    public static void main(String[] args) {
        //代码外部状态
        int extrinsicstate = 22;
        FlyweightFactory factory = new FlyweightFactory();

        Flyweight fx = factory.getFlyweight("x");
        fx.operation(--extrinsicstate);

        Flyweight fy = factory.getFlyweight("y");
        fy.operation(--extrinsicstate);

        Flyweight fz = factory.getFlyweight("z");
        fz.operation(--extrinsicstate);

        UnsharedConcreteFlyweight unsharedConcreteFlyweight = new UnsharedConcreteFlyweight();

        unsharedConcreteFlyweight.operation(--extrinsicstate);
    }
}
